/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package puente2;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author aureavm
 */
public class PersonasB extends Thread {
    Puente puente;
    String destino;
    int id;
    
    public PersonasB(Puente puente, int id){
         this.puente = puente;
         this.destino = "A";
         this.id = id;
    }
    public void run(){
        try {
            this.puente.pedir(this.destino, this.id);
            this.puente.pasar(this.id);
            this.puente.liberar();
        } catch (InterruptedException ex) {
            Logger.getLogger(PersonasB.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
